package peer.share;

import java.util.HashMap;

import peer.tools.Mdb;


public class VBlock {
	Mdb mdb;
	int blockNum;
	HashMap<Integer, ?> pieceTable;
	@SuppressWarnings("unchecked")
	VBlock(Mdb mdb,int blockNum){
		this.mdb=mdb;
		this.blockNum=blockNum;
		pieceTable=new HashMap();
	}
	
	int getPieceSum(){
		return pieceTable.size();
	}
	
	void addPiece(int pieceNum){
		pieceTable.put(pieceNum, null);
	}
	
	void delPiece(int pieceNum){
		pieceTable.remove(pieceNum);
	}
	
	boolean containsPiece(int pieceNum){
		return pieceTable.containsKey(pieceNum);
	}
	
	HashMap getPieceTable(){
		return pieceTable;
	}
	
}
